package com.dkg.day16.dao;

import com.dkg.day16.entity.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface BookDAO {
    @Insert("insert into book(book_name,book_author) values (#{book_name},#{book_author})")
    int save(Book book);
    @Delete("delete from book where book_id = #{book_id}")
    int delete(int book_id);
    @Update("update book set book_name = #{book_name}, book_author = #{book_author} where book_id = #{book_id}")
    int update(Book book);
    @Select("select * from book where book_id = #{book_id}")
    Book findById(int book_id);
    @Select("select * from book")
    List<Book> findAll();
}
